package fr.znight.chacunsatv;

import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnTouchListener;
import android.widget.ImageView;

public class BabyActivity  extends Activity {

	Context mContext;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_mobile_baby);

		mContext = this;

		final ImageView imageMainHome = (ImageView) findViewById(R.id.imageMainHome);
		imageMainHome.setOnTouchListener(new OnTouchListener() {
			public boolean onTouch(View arg0, MotionEvent arg1) {
				switch (arg1.getAction()) {
				case MotionEvent.ACTION_DOWN: {
					imageMainHome.setImageDrawable(getResources().getDrawable(R.drawable.home_clicked));
					break;
				}
				case MotionEvent.ACTION_UP:{
					imageMainHome.setImageDrawable(getResources().getDrawable(R.drawable.home));
					break;
				}
				}
				return true;
			}
		});

		final ImageView imageMyHome = (ImageView) findViewById(R.id.imageMyHome);
		imageMyHome.setOnTouchListener(new OnTouchListener() {
			public boolean onTouch(View arg0, MotionEvent arg1) {
				switch (arg1.getAction()) {
				case MotionEvent.ACTION_DOWN: {
					imageMyHome.setImageDrawable(getResources().getDrawable(R.drawable.baby_clicked));
					break;
				}
				case MotionEvent.ACTION_UP:{
					imageMyHome.setImageDrawable(getResources().getDrawable(R.drawable.baby));
					break;
				}
				}
				return true;
			}
		});

		final ImageView imageFav = (ImageView) findViewById(R.id.imageFav);
		imageFav.setOnTouchListener(new OnTouchListener() {
			public boolean onTouch(View arg0, MotionEvent arg1) {
				switch (arg1.getAction()) {
				case MotionEvent.ACTION_DOWN: {
					imageFav.setImageDrawable(getResources().getDrawable(R.drawable.star_clicked));
					break;
				}
				case MotionEvent.ACTION_UP:{
					imageFav.setImageDrawable(getResources().getDrawable(R.drawable.star));
					break;
				}
				}
				return true;
			}
		});
	}

	public void onClickMainHome(View v)
	{
		//Envoyer la commande a la GoogleTv
	}

	public void onClickMyHome(View v)
	{
		//Envoyer la commande a la GoogleTv
	}

	public void onClickAddToFav(View v)
	{
		//Envoyer la commande a la GoogleTv
	}

	private static final int MENU_NORMAL = 0;
	
	/* Creates the menu items */
    public boolean onCreateOptionsMenu(Menu menu) {
        menu.add(0, MENU_NORMAL, 0, "Normal mode");
        return true;
    }
 
    /* Handles item selections */
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
    	case MENU_NORMAL:
    		startActivity(new Intent(mContext, MobileActivity.class));
    		finish();
            return true;
        }
        return false;
    }
}
